home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / JAFO12.422 < prev    next >
Text File  |  1993-02-22  |  7KB  |  203 lines

  1. JAFO12.MOD - WWIV Time Bank
  2. JAFO #1 @18868
  3. Fri Feb 19 1993 18:32:14
  4. ┌────────────────────────────────────────────────────────────────────────────┐
  5. │ Mod Name      : JAFO12.MOD               Mod Author: JAFO 1@1     TerraNET │
  6. │ Difficulty    : ██▒▒▒▒▒▒▒▒                                1@8857  IceNET   │
  7. │ WWIV Version  : 4.22                                      1@8861  WWIVnet  │
  8. │ Mod Date      : 02/19/93                                  1@18868 WWIVLink │
  9. │ Files Affected: BBS.C, MISCCMD.C                                           │
  10. │ Description   : WWIV Time Bank                                             │
  11. └────────────────────────────────────────────────────────────────────────────┘
  12.  
  13. ══[ Description ]═════════════════════════════════════════════════════════════
  14.  
  15. This WWIV Time Bank modification will give your users a convenient way of
  16. saving their time online for use at a later date.  It does not have any fancy
  17. gambling.  It simply lets users withdraw and deposit time.  The sysop can set
  18. limits on how much time can be deposited into the Time Bank as well as how
  19. much total time a user can have online.
  20.  
  21. ══[ Legend ]══════════════════════════════════════════════════════════════════
  22.  
  23.   =  Existing line - Do not change
  24.   +  Add this line
  25.  
  26. ══[ Step 1 ]══════════════════════════════════════════════════════════════════
  27.  
  28. Please back up your source code.  Even the best programmers make mistakes.
  29.  
  30. ══[ Step 2 ]══════════════════════════════════════════════════════════════════
  31.  
  32. In BBS.C, add the following "case" statement in "void mainmenu".
  33.  
  34. =      case '.':
  35. =        helpl=26;
  36. =        do_chains();
  37. =        break;
  38. +      case '$':
  39. +        timebank();
  40. +        break;
  41. =      case 'A':
  42. =        helpl=19;
  43. =        write_automessage();
  44. =        break;
  45.  
  46. ══[ Step 3 ]══════════════════════════════════════════════════════════════════
  47.  
  48. Add the following block of code to the end of MISCCMD.C.  You may change the
  49. values shown on the first two lines to whatever you like.  If you would rather
  50. not set limits, I suggest setting each to 999.
  51.  
  52. #define MAX_CALL 120    /* Max time online is set to 2 hours */
  53. #define MAX_BANK 60     /* Max bank time is set to 1 hour */
  54.  
  55. void timebank(void)
  56. {
  57.   char s[80];
  58.   double tle;
  59.   int i,tli;
  60.   char ch=0;
  61.  
  62.   tle=nsl();
  63.   while ((ch!='Q') && (!hangup)) {
  64.     outchr(12);
  65.     sprintf(s,"%s Time Bank",syscfg.systemname);
  66.     if (strlen(s)<43) {
  67.       for (i=0; i<21-strlen(s)/2; i++)
  68.         outchr(32);
  69.     }
  70.     prt(1,s);
  71.     nln(2);
  72.     sprintf(s,"Greetings, %s",thisuser.name);
  73.     for (i=0; i<21-strlen(s)/2; i++)
  74.       outchr(32);
  75.     prt(5,s);
  76.     nln(2);
  77.     tli=(int)(tle/60);
  78.     npr("You have %3d min(s) this call.     Max: %3d\r\n",tli,MAX_CALL);
  79.     npr("You have %3d min(s) in the bank.   Max: %3d\r\n",thisuser.banktime,
  80.         MAX_BANK);
  81.     nl();
  82.     prt(2,"1. Deposit Time"); nl();
  83.     prt(2,"2. Withdraw Time"); nl();
  84.     prt(2,"Q. Quit to BBS");
  85.     nln(2);
  86.     prt(4,"Enter Your Selection?");
  87.     ansic(0);
  88.     outchr(32);
  89.     ansic(6);
  90.     ch=onek("Q12");
  91.     switch (ch) {
  92.       case '1':
  93.         if (thisuser.banktime<MAX_BANK) {
  94.           i=(MAX_BANK-thisuser.banktime>tli) ? tli :
  95.              MAX_BANK-thisuser.banktime;
  96.           ansic(2);
  97.           npr("You can deposit up to %d more minute(s).\r\n",i);
  98.           prt(1,"How many minutes do you wish to deposit? ");
  99.           input(s,3);
  100.           if (s[0]) {
  101.             i=atoi(s);
  102.             if ((i<=0) || (i>tli)) {
  103.               prt(2,"Can't deposit that amount.");
  104.               nln(2);
  105.               pausescr();
  106.             } else {
  107.               if (i+thisuser.banktime>MAX_BANK) {
  108.                 ansic(5);
  109.                 npr("You can have a max of %d minutes in the bank.",
  110.                     MAX_BANK);
  111.                 nln(2);
  112.                 pausescr();
  113.               } else {
  114.                 thisuser.extratime-=i*60;
  115.                 thisuser.banktime+=i;
  116.                 sprintf(s,"%d minutes deposited into the Time Bank.",i);
  117.                 sysoplog(s);
  118.                 nl();
  119.                 pausescr();
  120.               }
  121.             }
  122.           } else {
  123.             prt(2,"Can't deposit that amount.");
  124.             nln(2);
  125.             pausescr();
  126.           }
  127.         } else {
  128.           prt(2,"Can't deposit, your account is already full!");
  129.           nln(2);
  130.           pausescr();
  131.         }
  132.         break;
  133.       case '2':
  134.         if (thisuser.banktime) {
  135.           if (!(tli>=MAX_CALL)) {
  136.             sprintf(s,"You have %d minute(s) in your account.",
  137.                     thisuser.banktime);
  138.             prt(2,s);
  139.             nl();
  140.             i=(thisuser.banktime+tli>MAX_CALL) ? MAX_CALL-tli :
  141.                thisuser.banktime;
  142.             ansic(5);
  143.             npr("You can withdraw up to %d minute(s).\r\n",i);
  144.             prt(1,"How many minutes do you wish to withdraw? ");
  145.             input(s,3);
  146.             if (s[0]) {
  147.               i=atoi(s);
  148.               tli=(int)(tle/60);
  149.               if ((i<=0) || (i>thisuser.banktime) || (i+tli>MAX_CALL)) {
  150.                 prt(2,"Can't withdraw that amount.");
  151.                 nln(2);
  152.                 pausescr();
  153.               } else {
  154.                 thisuser.extratime+=i*60;
  155.                 thisuser.banktime-=i;
  156.                 sprintf(s,"%d minutes withdrew from the Time Bank.",i);
  157.                 sysoplog(s);
  158.                 nl();
  159.                 pausescr();
  160.               }
  161.             } else {
  162.               prt(2,"Can't withdraw that amount.");
  163.               nln(2);
  164.               pausescr();
  165.             }
  166.           } else {
  167.             prt(2,"Too much online time, can't withdraw!");
  168.             nln(2);
  169.             pausescr();
  170.           }
  171.         } else {
  172.           prt(2,"Can't withdraw, no time in account.");
  173.           nln(2);
  174.           pausescr();
  175.         }
  176.         break;
  177.       case 'Q':
  178.         break;
  179.     }
  180.     tle=nsl();
  181.   }
  182. }
  183.  
  184. ══[ Step 4 ]══════════════════════════════════════════════════════════════════
  185.  
  186. Compile your source.
  187.  
  188. ══[ Disclaimer ]══════════════════════════════════════════════════════════════
  189.  
  190. Don't complain to me if your board gets fried, your hard disk goes nuts, or
  191. something terrible happens.  The code in this mod should be harmless, but I
  192. can't guarantee it will work for you.  It works on my board.
  193.  
  194. JAFO 1@1     TerraNET
  195.      1@8857  IceNET
  196.      1@8861  WWIVnet
  197.      1@18868 WWIVLink
  198. 
  199.           7───────────────────── 1Blue Thunder BBS 7─────────────────────
  200.  
  201.           1TerraNET @1 7∙ 1IceNET @8857 7∙ 1WWIVnet @8861 7∙ 1WWIVLink @188680
  202.  
  203.